
import {
  Root,
  RootText,
  CanvasWidget,
  ColorComponent,
  ColorPicker,
  Draggable,
  FileBrowserView,
  GaugePointer,
  Gauge,
  ImageAnimation,
  ImageValue,
  Candidates,
  LangIndicator,
  LineNumber,
  Mledit,
  ProgressCircle,
  RichTextView,
  RichText,
  HscrollLabel,
  ListItem,
  ListViewH,
  ListView,
  ScrollBar,
  ScrollView,
  SlideMenu,
  SlideIndicator,
  SlideView,
  Switch,
  TextSelector,
  TimeClock,
  Vpage,
  AppBar,
  ButtonGroup,
  Button,
  CheckButton,
  ClipView,
  ColorTile,
  Column,
  ComboBoxItem,
  DialogClient,
  DialogTitle,
  DigitClock,
  Dragger,
  Edit,
  GridItem,
  Grid,
  GroupBox,
  Label,
  Pages,
  ProgressBar,
  Row,
  Slider,
  TabButtonGroup,
  TabButton,
  TabControl,
  View,
  Dialog,
  Window,
  GifImage,
  Keyboard,
  MutableImage,
  SvgImage,
  CalibrationWin,
  ComboBox,
  Image,
  Overlay,
  Popup,
  SpinBox,
  SystemBar,
  ComboBoxEx,
  RadioButton,
      
} from "../components/";
    
    // Creates an element with an element type, props and a root instance
function createElement(type: string, props: any): any {
  const COMPONENTS = { 
    ROOT: () => Root(props),
    ROOTTEXT: () => RootText(props),
    CANVASWIDGET: () => CanvasWidget(props),
    canvas_widget: () => CanvasWidget(props),
    COLORCOMPONENT: () => ColorComponent(props),
    color_component: () => ColorComponent(props),
    COLORPICKER: () => ColorPicker(props),
    color_picker: () => ColorPicker(props),
    DRAGGABLE: () => Draggable(props),
    draggable: () => Draggable(props),
    FILEBROWSERVIEW: () => FileBrowserView(props),
    file_browser_view: () => FileBrowserView(props),
    GAUGEPOINTER: () => GaugePointer(props),
    gauge_pointer: () => GaugePointer(props),
    GAUGE: () => Gauge(props),
    gauge: () => Gauge(props),
    IMAGEANIMATION: () => ImageAnimation(props),
    image_animation: () => ImageAnimation(props),
    IMAGEVALUE: () => ImageValue(props),
    image_value: () => ImageValue(props),
    CANDIDATES: () => Candidates(props),
    candidates: () => Candidates(props),
    LANGINDICATOR: () => LangIndicator(props),
    lang_indicator: () => LangIndicator(props),
    LINENUMBER: () => LineNumber(props),
    line_number: () => LineNumber(props),
    MLEDIT: () => Mledit(props),
    mledit: () => Mledit(props),
    PROGRESSCIRCLE: () => ProgressCircle(props),
    progress_circle: () => ProgressCircle(props),
    RICHTEXTVIEW: () => RichTextView(props),
    rich_text_view: () => RichTextView(props),
    RICHTEXT: () => RichText(props),
    rich_text: () => RichText(props),
    HSCROLLLABEL: () => HscrollLabel(props),
    hscroll_label: () => HscrollLabel(props),
    LISTITEM: () => ListItem(props),
    list_item: () => ListItem(props),
    LISTVIEWH: () => ListViewH(props),
    list_view_h: () => ListViewH(props),
    LISTVIEW: () => ListView(props),
    list_view: () => ListView(props),
    SCROLLBAR: () => ScrollBar(props),
    scroll_bar: () => ScrollBar(props),
    SCROLLVIEW: () => ScrollView(props),
    scroll_view: () => ScrollView(props),
    SLIDEMENU: () => SlideMenu(props),
    slide_menu: () => SlideMenu(props),
    SLIDEINDICATOR: () => SlideIndicator(props),
    slide_indicator: () => SlideIndicator(props),
    SLIDEVIEW: () => SlideView(props),
    slide_view: () => SlideView(props),
    SWITCH: () => Switch(props),
    switch: () => Switch(props),
    TEXTSELECTOR: () => TextSelector(props),
    text_selector: () => TextSelector(props),
    TIMECLOCK: () => TimeClock(props),
    time_clock: () => TimeClock(props),
    VPAGE: () => Vpage(props),
    vpage: () => Vpage(props),
    APPBAR: () => AppBar(props),
    app_bar: () => AppBar(props),
    BUTTONGROUP: () => ButtonGroup(props),
    button_group: () => ButtonGroup(props),
    BUTTON: () => Button(props),
    button: () => Button(props),
    CHECKBUTTON: () => CheckButton(props),
    check_button: () => CheckButton(props),
    CLIPVIEW: () => ClipView(props),
    clip_view: () => ClipView(props),
    COLORTILE: () => ColorTile(props),
    color_tile: () => ColorTile(props),
    COLUMN: () => Column(props),
    column: () => Column(props),
    COMBOBOXITEM: () => ComboBoxItem(props),
    combo_box_item: () => ComboBoxItem(props),
    DIALOGCLIENT: () => DialogClient(props),
    dialog_client: () => DialogClient(props),
    DIALOGTITLE: () => DialogTitle(props),
    dialog_title: () => DialogTitle(props),
    DIGITCLOCK: () => DigitClock(props),
    digit_clock: () => DigitClock(props),
    DRAGGER: () => Dragger(props),
    dragger: () => Dragger(props),
    EDIT: () => Edit(props),
    edit: () => Edit(props),
    GRIDITEM: () => GridItem(props),
    grid_item: () => GridItem(props),
    GRID: () => Grid(props),
    grid: () => Grid(props),
    GROUPBOX: () => GroupBox(props),
    group_box: () => GroupBox(props),
    LABEL: () => Label(props),
    label: () => Label(props),
    PAGES: () => Pages(props),
    pages: () => Pages(props),
    PROGRESSBAR: () => ProgressBar(props),
    progress_bar: () => ProgressBar(props),
    ROW: () => Row(props),
    row: () => Row(props),
    SLIDER: () => Slider(props),
    slider: () => Slider(props),
    TABBUTTONGROUP: () => TabButtonGroup(props),
    tab_button_group: () => TabButtonGroup(props),
    TABBUTTON: () => TabButton(props),
    tab_button: () => TabButton(props),
    TABCONTROL: () => TabControl(props),
    tab_control: () => TabControl(props),
    VIEW: () => View(props),
    view: () => View(props),
    DIALOG: () => Dialog(props),
    dialog: () => Dialog(props),
    WINDOW: () => Window(props),
    window: () => Window(props),
    GIFIMAGE: () => GifImage(props),
    gif_image: () => GifImage(props),
    KEYBOARD: () => Keyboard(props),
    keyboard: () => Keyboard(props),
    MUTABLEIMAGE: () => MutableImage(props),
    mutable_image: () => MutableImage(props),
    SVGIMAGE: () => SvgImage(props),
    svg_image: () => SvgImage(props),
    CALIBRATIONWIN: () => CalibrationWin(props),
    calibration_win: () => CalibrationWin(props),
    COMBOBOX: () => ComboBox(props),
    combo_box: () => ComboBox(props),
    IMAGE: () => Image(props),
    image: () => Image(props),
    OVERLAY: () => Overlay(props),
    overlay: () => Overlay(props),
    POPUP: () => Popup(props),
    popup: () => Popup(props),
    SPINBOX: () => SpinBox(props),
    spin_box: () => SpinBox(props),
    SYSTEMBAR: () => SystemBar(props),
    system_bar: () => SystemBar(props),
    COMBOBOXEX: () => ComboBoxEx(props),
    combo_box_ex: () => ComboBoxEx(props),
    RADIOBUTTON: () => RadioButton(props),
    radio_button: () => RadioButton(props),

    default: View(props)
  };  

  let func = (COMPONENTS as any)[type];
  if(!func) {
    console.log(`${type} is not supported!!!!!!!!!!!!!!!`);
    func = COMPONENTS.default;
  }

  return func();
}
    
export { createElement };
